package com.weu.contorller;

import com.weu.bean.Brand;
import com.weu.bean.CarModel;
import com.weu.bean.CarType;
import com.weu.bean.Series;
import com.weu.service.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

@Controller

public class helloController {

    @Resource
    private IBrandService iBrandService;

    @Resource
    private ICarTypeService iCarTypeService;

    @Resource
    private ISeriesService iSeriesService;

    @Resource
    private ICarService iCarService;

    @Resource
    private IModelService iModelService;

    //    @ResponseBody
    @RequestMapping("/index")
    public String hello(Model model) {
        //  获取所有品牌
        List<Brand> brandList = iBrandService.getAll();
        model.addAttribute("brandList", brandList);

        //  获取所有类型
        List<CarType> carTypeList = iCarTypeService.getAll();
        model.addAttribute("carTypeList", carTypeList);

        //  获取所有系列
        List<Series> seriesList = iSeriesService.getAll();
        model.addAttribute("seriesList", seriesList);

        //  获取所有型号(为了获取型号名称)
        List<CarModel> carModelList = iModelService.getAll();
        model.addAttribute("carModelList", carModelList);
        return "index";
    }

//    @RequestMapping("/test")
//    public String test(){
//        return "backstage/index";
//    }

    @RequestMapping("/toabout")
    public String toAbout() {
        return "about";
    }

    @RequestMapping("/toinventory-grid")
    public String toInventory_grid() {
        return "inventory-grid";
    }

    @RequestMapping("/toinventory-list")
    public String toInventory_list() {
        return "inventory-list";
    }

    @RequestMapping("/toinventory-detail")
    public String toInventory_detail() {
        return "inventory-detail";
    }

    @RequestMapping("/toservices")
    public String services() {
        return "services";
    }

    @RequestMapping("/togallery")
    public String gallery() {
        return "gallery";
    }

    @RequestMapping("/tocompare")
    public String compare() {
        return "compare";
    }

    @RequestMapping("/tocareer")
    public String career() {
        return "career";
    }

    @RequestMapping("/tofaq")
    public String faq() {
        return "faq";
    }

    @RequestMapping("/toerror")
    public String error() {
        return "404";
    }

    @RequestMapping("/toshop-full-width")
    public String shop_full_width() {
        return "shop-full-width";
    }

    @RequestMapping("/toshop-single-left-sidebar")
    public String shop_single_left_sidebar() {
        return "shop-single-left-sidebar";
    }

    @RequestMapping("/toblog-grid")
    public String blog_grid() {
        return "blog-grid";
    }

    @RequestMapping("/tosupport-article-details")
    public String support_article_details() {
        return "support-article-details";
    }

    @RequestMapping("/togeneral-support")
    public String general_support() {
        return "general-support";
    }

    @RequestMapping("/tohow-it-work")
    public String how_it_work() {
        return "how-it-work";
    }

    @RequestMapping("/tohelp-center")
    public String help_center() {
        return "help-center";
    }

    @RequestMapping("/toterms-and-condition")
    public String terms_and_condition() {
        return "terms-and-condition";
    }

    @RequestMapping("/tooffers")
    public String offers() {
        return "offers";
    }

    @RequestMapping("/tooffer-details")
    public String offer_details() {
        return "offer-details";
    }

    @RequestMapping("/tocoming-soon")
    public String coming_soon() {
        return "coming-soon";
    }

    @RequestMapping("/tosubmit-car")
    public String submit_car() {
        return "submit-car";
    }

    @RequestMapping("/tosingle-blog")
    public String single_blog() {
        return "single-blog";
    }

    @RequestMapping("/toshop-single-full-width")
    public String shop_single_full_width() {
        return "shop-single-full-width";
    }

    @RequestMapping("/tocontact")
    public String contact() {
        return "contact";
    }

    @RequestMapping("/test")
    public String test() {
        return "test";
    }
}
